package com.meng.system.task;

import org.springframework.stereotype.Component;

import java.util.Date;

@Component("demoTask")
public class DemoTask {

    public void taskWithParams(String params) {

        try {
            Thread.sleep(25000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("执行有参示例任务：" + params);
    }

    public void taskNoParams() {

        try {
            System.out.println("taskNoParams:开始时间:"+new Date().toString());
            //5fen
            Thread.sleep(300000);
            System.out.println("taskNoParams:结束时间:"+new Date().toString());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("执行无参示例任务");
    }


    public void taskNoParams2() {

        try {
            System.out.println("taskNoParams2：开始时间:"+new Date().toString());
            //shifen
            Thread.sleep(600000);
            System.out.println("taskNoParams2：结束时间:"+new Date().toString());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("执行无参示例任务");
    }
}